package com.cmstop.bzgd.ui.adapter.holder;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.cmstop.bzgd.R;
import com.cmstop.bzgd.beans.FProgram;
import com.cmstop.bzgd.ui.utils.GlideUtil;
import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.ruihang.generalibrary.ui.widget.CustomEXImageView;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;

import butterknife.BindView;
import butterknife.ButterKnife;

public class LookBackNewHolder extends BaseRecylerHolder<FProgram> implements View.OnClickListener {
    @BindView(R.id.tv_item_title)
    protected CustomFontTextView title;
    @BindView(R.id.iv_item_img)
    protected CustomEXImageView img;

    private FProgram mNewsItem;

    public LookBackNewHolder(Context context, View itemView) {
        super(context, itemView);
        itemView.setOnClickListener(this);
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(FProgram newsItem) {
        mNewsItem = newsItem;
        title.setText(TextUtils.isEmpty(newsItem.getProgrammeName()) ? "" : newsItem.getProgrammeName());
        GlideUtil.getGlideWithMid169DefNoFit(context, newsItem.getProgrammeImage()).into(img);
    }

    @Override
    public void onClick(View v) {
        if (internalClick != null) {
            itemView.setTag(R.id.adapter_item_data_key, mNewsItem);
            internalClick.onItemInternalClick(itemView, v, getAdapterPosition());
        }
    }
}
